<?php
include ("../inc/config.inc.php");
include ("../inc/mysql.inc.php");
include ("inc/tool.inc.php");
$link = connect();
// 根据get传递的id值查询数据sfk_father_module对应的信息
$query = "select module_name,sort from sfk_father_module where id = {$_GET['id']}";
$sel = execute($link,$query);
$data = $sel->fetch_assoc();
// 处理修改父板块信息
//include ("check/father_module_check.inc.php");
if (isset($_POST['submit'])) {
    $check_type = "update";
    include ('check/father_module_check.inc.php');
    $url = "father_module_update.php?id={$_GET['id']}";
    $_POST = escape($link,$_POST);
    $update = "UPDATE sfk_father_module SET module_name = '{$_POST['module_name']}', sort = {$_POST['sort']} where id = {$_GET['id']}";
    $up = execute($link,$update);
    if ($link->affected_rows != 0) {
        skip('father_module.php','ok','修改模块信息成功');
    } else {
        skip($url,'error','修改模块失败');
    }
}
?>
<?php
$template['title'] = '修改父板块';
include "inc/header.inc.php"
?>
<div id="main">
	<div class="title" style="margin-bottom:20px;">修改父版块</div>
	<form method="post" >
		<table class="au">
			<tr>
				<td>版块名称</td>
				<td><input name="module_name" value="<?php echo $data['module_name']?>" type="text" /></td>
				<td>
					版块名称不得为空，最大不得超过20个字符
				</td>
			</tr>
			<tr>
				<td>排序</td>
				<td><input name="sort" type="text" value="<?php echo $data['sort']?>" /></td>
				<td>
					填写一个数字即可
				</td>
			</tr>
		</table>
		<input style="margin-top:20px;cursor:pointer;" class="btn" type="submit" name="submit" value="添加"  />
	</form>
</div>
<script>
    function del() {
        var msg = "请确定彻底删除吗？\n\n";
        var mes = "该操作不可逆！！\n\n请再次确定 ";
        if (confirm(msg) == true && confirm(mes)) {
            return true;
        } else {
            return false;
        }
    }
</script>
<?php include 'inc/footer.inc.php'?>